package com.eastfair.imaster.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.imaster.enumeration.BusinResourceCorrelationTypeEnum;
import com.eastfair.imaster.enumeration.BusinResourceResourceTypeEnum;
import com.eastfair.imaster.enumeration.BusinResourceStatusEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 业务资源表
 * </p>
 *
 * @author ligang
 * @since 2022-03-10
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("r_busin_resource")
@ApiModel(value = "BusinResource", description = "业务资源表")
@AllArgsConstructor
public class BusinResource extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 关联身份#{user:用户;exhibitor:展商;project:项目;sponsor:主办}
     */
    @ApiModelProperty(value = "关联身份#{user:用户;exhibitor:展商;project:项目;sponsor:主办}")
    @TableField(value = "correlation_type")
    @Excel(name = "关联身份#{user:用户;exhibitor:展商;project:项目;sponsor:主办}", replace = {"用户_USER", "展商_EXHIBITOR", "项目_PROJECT", "主办_SPONSOR",  "_null"})
    private BusinResourceCorrelationTypeEnum correlationType;

    /**
     * 关联ID
     */
    @ApiModelProperty(value = "关联ID")
    @TableField(value = "correlation_id")
    @Excel(name = "关联ID")
    private Long correlationId;

    /**
     * 资源类型#{news:新闻;video:视频;data:资料}
     */
    @ApiModelProperty(value = "资源类型#{news:新闻;video:视频;data:资料}")
    @TableField(value = "resource_type")
    @Excel(name = "资源类型#{news:新闻;video:视频;data:资料}", replace = {"新闻_NEWS", "视频_VIDEO", "资料_DATA",  "_null"})
    private BusinResourceResourceTypeEnum resourceType;

    /**
     * 资源标题
     */
    @ApiModelProperty(value = "资源标题")
    @Size(max = 255, message = "资源标题长度不能超过255")
    @TableField(value = "title", condition = LIKE)
    @Excel(name = "资源标题")
    private String title;

    /**
     * 富文本
     */
    @ApiModelProperty(value = "富文本")

    @TableField(value = "rich_text", condition = LIKE)
    @Excel(name = "富文本")
    private String richText;

    /**
     * 附属业务详情json格式
     */
    @ApiModelProperty(value = "附属业务详情json格式")

    @TableField(value = "busin_details", condition = LIKE)
    @Excel(name = "附属业务详情json格式")
    private String businDetails;

    /**
     * 文件地址 数组
     */
    @ApiModelProperty(value = "文件地址 数组")
    @Size(max = 1024, message = "文件地址 数组长度不能超过1024")
    @TableField(value = "url", condition = LIKE)
    @Excel(name = "文件地址 数组")
    private String url;

    /**
     * 状态 #{normal:正常;wait_init:待初始化;forbidden:禁用;waiting:待审核;refuse:拒绝}
     */
    @ApiModelProperty(value = "状态 #{normal:正常;wait_init:待初始化;forbidden:禁用;waiting:待审核;refuse:拒绝}")
    @TableField(value = "status")
    @Excel(name = "状态 #{normal:正常;wait_init:待初始化;forbidden:禁用;waiting:待审核;refuse:拒绝}", replace = {"正常_NORMAL", "待初始化_WAIT_INIT", "禁用_FORBIDDEN", "待审核_WAITING", "拒绝_REFUSE",  "_null"})
    private BusinResourceStatusEnum status;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField(value = "sequence")
    @Excel(name = "排序")
    private Integer sequence;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enable")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnable;

    /**
     * 是否删除(默认0：未删除1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除1:已删除)")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除(默认0：未删除1:已删除)")
    private Integer isDeleted;

    /**
     * 是否上下架 1是 0否
     */
    @ApiModelProperty(value = "是否上下架 1是 0否")
    @TableField(value = "is_shelves")
    @Excel(name = "是否上下架 1是 0否")
    private Integer isShelves;


    @Builder
    public BusinResource(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Long projectId, BusinResourceCorrelationTypeEnum correlationType, Long correlationId, BusinResourceResourceTypeEnum resourceType, String title, 
                    String richText, String businDetails, String url, BusinResourceStatusEnum status, Integer sequence, Integer isEnable, 
                    Integer isDeleted, Integer isShelves) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.projectId = projectId;
        this.correlationType = correlationType;
        this.correlationId = correlationId;
        this.resourceType = resourceType;
        this.title = title;
        this.richText = richText;
        this.businDetails = businDetails;
        this.url = url;
        this.status = status;
        this.sequence = sequence;
        this.isEnable = isEnable;
        this.isDeleted = isDeleted;
        this.isShelves = isShelves;
    }

}
